package com.briup.product_source.web.controller;

import com.briup.product_source.service.AnalysisService;
import com.briup.product_source.util.Result;
import com.briup.product_source.util.ResultUtil;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.*;

/*
* 首页大屏控制类
* */
@Api(tags = "首页大屏")
@RestController
@RequestMapping("/analysis")
public class AnalysisController {
    @Autowired
    private AnalysisService analysisService;
    /*@GetMapping("/count")
    public Result<List<Object>> countNum(){
        HashMap<String, List<Object>> map = new HashMap<>();
        List<Object> list = Arrays.asList("栏舍", "栏圈", "动物", "冷库", "员工");
        map.put("name",list);
        List<Object>data= Arrays.asList(map,analysisService.countNum());
        return ResultUtil.success(data);
    }*/

    @GetMapping("/count")
    public Result<Map<String, List<Object>>> countNumByMap(){
        Map<String, List<Object>> data = analysisService.countNum();
        return ResultUtil.success(data);
    }

    @GetMapping("/indexCount")
    public Result<Map<String, Integer>> countWeight(){
        Map<String, Integer> data = analysisService.countWeight();
        return ResultUtil.success(data);
    }

    @GetMapping("/countDisease")
    public Result<Map<String, Integer>> countDisease(){
        Map<String, Integer> data = analysisService.countDisease();
        return ResultUtil.success(data);
    }

    @GetMapping("/countSales")
    public Result<Map<String, List<Object>>> countSales(){
        Map<String, List<Object>> data = analysisService.countSales();
        return ResultUtil.success(data);
    }



}
